package com.example.xpvideo.validator;

import cn.hutool.core.lang.Validator;
import com.example.xpvideo.annotations.IsPhone;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author : 洪俊新
 * @date : 2021/2/28 15:19
 * @description:
 */
public class IsPhoneConstraintValidator implements ConstraintValidator<IsPhone, String> {

    @Override
    public void initialize(IsPhone constraintAnnotation) {

    }

    @Override
    public boolean isValid(String value,
                           ConstraintValidatorContext context) {

        return Validator.isMobile(value);


    }
}
